home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / yerk / mps231ss.hqx / Mops source / Module source / call1&Lmod.txt < prev    next >
Text File  |  1993-02-01  |  1KB  |  53 lines

  1. \ This module handles the CallFirst and CallLast operations.  Aug 91.
  2.  
  3. : 1ST&LAST    14 -  ;
  4.  
  5. : CallFirst
  6.     ?exec  #last ?error 51
  7.     getSelect  1 ++> #1st  ;        immediate
  8.  
  9. : CallLast
  10.     ?exec
  11.     getSelect  1 ++> #last  ;        immediate
  12.  
  13.  
  14. : (GET)  { mark \ #F #L cnt addr -- mark }
  15.     0 -> #F  0 -> #L
  16.     #1st #last +  -> cnt
  17.     BEGIN  cnt  while  >r  1 --> cnt  REPEAT    \ Reverse into return stk!
  18.     superM
  19.     IF    superM 1-  7 btest
  20.         IF    superM 1st&last -> addr  addr w@ -> #F
  21.             addr 2+ w@ -> #L
  22.         THEN
  23.     THEN
  24.   \ Get 1st
  25.     #F #L + 4*  --> addr
  26.     #F 0 ?DO  addr @  ,  4 ++> addr  LOOP
  27.     #1st -> cnt
  28.     BEGIN  cnt  WHILE  r> ,  1 --> cnt  REPEAT
  29.   \ Get last
  30.     #L 0 ?DO  addr @  ,  4 ++> addr  LOOP
  31.     #last -> cnt
  32.     BEGIN  cnt  WHILE  r> ,  1 --> cnt  REPEAT
  33.     #F ++> #1st  #1st w,  #L ++> #last  #last w,
  34.     mark  ;
  35.  
  36. : (C1)  { \ addr -- }
  37.     #1st 0EXIT
  38.     thisM 1st&last  -> addr  #1st #last + 4*  --> addr
  39.     #1st FOR
  40.         true -> selfRef?
  41.         addr @  ^class  findm  swap  bind_to_self
  42.         ?unHoldMod  4 ++> addr
  43.     NEXT  ;
  44.  
  45. : (CL)  { \ addr -- }
  46.     #last  0EXIT
  47.     thisM 1st&last  -> addr
  48.     #last FOR
  49.         true -> selfRef?  4 --> addr
  50.         addr @  ^class  findm  swap  bind_to_self
  51.         ?unHoldMod
  52.     NEXT  ;
  53.